<!DOCTYPE html>
<html>
<head>
<include file="Include:meta" />
<title>运营周报详情-目的地运营集团数据管理平台</title>
<include file="Include:style" />
</head>
<body>
<include file="Include:header" />
<include file="Include:left" />
<div id="main">
	<div class="crumbs">
		<if condition="$audit eq 1">
			<div class="crumbs-text">运营周报 > 运营周报详情</div>
		<else/>
			<div class="crumbs-text">项目 > [{$project['project_num']}]{$project['project_name']} > 运营周报 > 运营周报详情</div>
		</if>
	</div>
	<if condition="$last neq NULL"><a class="fix_page fix_prev animate" href="__APP__/Project/project_operate_detail/id/{$last['id']}/pid/{$project['id']}/audit/{$audit}/keyword/{$keyword}" data-toggle="tooltip" data-placement="top" title="" class="left" data-original-title="上一周"></a></if>
	<if condition="$next neq NULL"><a class="fix_page fix_next animate" href="__APP__/Project/project_operate_detail/id/{$next['id']}/pid/{$project['id']}/audit/{$audit}/keyword/{$keyword}" data-toggle="tooltip" data-placement="top" title="" class="right" data-original-title="下一周"></a></if>
	<div id="content">
		<div class="form-main">
			<div class="form-title"><if condition="$last neq NULL"><a style="font-size: 20px;" href="__APP__/Project/project_operate_detail/id/{$last['id']}/pid/{$project['id']}/audit/{$audit}/keyword/{$keyword}" data-toggle="tooltip" data-placement="top" title="" class="left" data-original-title="上一周"><i class="glyphicon glyphicon-arrow-left"></i></a></if>运营周报详情<if condition="$next neq NULL"><a style="font-size: 20px;" href="__APP__/Project/project_operate_detail/id/{$next['id']}/pid/{$project['id']}/audit/{$audit}/keyword/{$keyword}" data-toggle="tooltip" data-placement="top" title="" class="right" data-original-title="下一周"><i class="glyphicon glyphicon-arrow-right"></i></a></if></div>
			<div class="clearboth">
				<div class="form-item">
					<div class="input-label">[项目编号]名称</div>
					<div class="input-item">[{$project['project_num']}]{$project['project_name']}</div>
				</div>
				<div class="form-item">
					<div class="input-label">责任人</div>
					<div class="input-item">{$operate['add_user']}</div>
				</div>
				<div class="form-item">
					<div class="input-label">周期</div>
					<div class="input-item">{$operate['year']}年 {$week_detail}</div>
				</div>
				<div class="form-item">
					<div class="input-label">附件</div>
					<div class="input-item"><if condition="$operate['file_url'] neq NULL">{$operate['file_name']}<a href="{$operate['file_url']}" class="ml5" data-toggle="tooltip" data-placement="right" title="下载"><i class="glyphicon glyphicon-download-alt"></i></a></if></div>
				</div>
			</div>
			<div class="form-sub-title">工作汇报</div>
			<div class="form-table-item">
				<table class="table">
					<foreach name="gzhb_detail" item="vo">
					<tr class="form-table-header Text_c">
						<if condition="is_permission('ZB',NULL,1) and ($audit eq 1)"><td colspan="3" <if condition="$vo['detail'][0]['third_name'] eq NULL">class="title-box"</if>><else/><td colspan="2"></if>
							{$vo['second_name']}
						</td>
					</tr>
					<foreach name="vo['detail']" item="bo">
					<tr oid="{$bo['id']}">
						<if condition="$bo['third_name'] eq NULL">
							<td colspan="2">
								{$bo['content']}
							</td>
						<else/>
							<td width="20%" class="title-box">{$bo['third_name']}</td>
							<td>{$bo['content']}</td>
						</if>
						<if condition="is_permission('ZB',NULL,1) and ($audit eq 1)">
						<td class="pf" width="5%">
							<if condition="$bo['answer'] eq 1">
								<a class="reply_btn" href="javascript:void(0)" <if condition="$bo['third_name'] eq NULL">txt="{$vo['second_name']}"<else />txt="{$bo['third_name']}"</if>>批复</a>
							<else/>
								已批复
							</if>
						</td>
						</if>
					</tr>
					</foreach>
					</foreach>
				</table>
			</div>
			<if condition="($project_bg['project_stage'] eq '已开业') and (($mp neq NULL) or ($ec neq NULL))">
			<div class="form-sub-title">经营数据</div>
			<div class="form-table-item">
				<table class="table table-border">
					<if condition="$mp neq NULL">
						<tr class="td-weight td-weight">
							<td class="Text_c middle" width="10%" <if condition="$mp neq NULL">rowspan="{$mphj['sum']+2}"<else/>rowspan="3"</if>>门票</td>
							<td class="Text_c middle" width="10%" rowspan="2">种类</td>
							<td class="Text_c" width="20%" colspan="2">散客</td>
							<td class="Text_c" width="15%" colspan="2">团队</td>
							<td class="Text_c" width="16%" colspan="2">共计</td>
						</tr>
						<tr class="td-weight td-weight">
							<td class="Text_c">人数</td>
							<td class="Text_c">金额(元)</td>
							<td class="Text_c">人数</td>
							<td class="Text_c">金额(元)</td>
							<td class="Text_c">人数</td>
							<td class="Text_c">金额(元)</td>
						</tr>
						<foreach name="mp" item="vo">
						<tr>
							<td class="Text_c">{$vo['third_name']}</td>
							<td>{$vo['sk_p']}</td>
							<td>{$vo['sk_m']}</td>
							<td>{$vo['td_p']}</td>
							<td>{$vo['td_m']}</td>
							<td>{$vo['hj_p']}</td>
							<td>{$vo['hj_m']}</td>
						</tr>
						</foreach>
						<tr>
							<td class="fbold det-tr-bg Text_c middle">门票合计</td>
							<td class="det-tr-bg"></td>
							<td class="det-tr-bg">{$mphj['sk_p']}</td>
							<td class="det-tr-bg">{$mphj['sk_m']}</td>
							<td class="det-tr-bg">{$mphj['td_p']}</td>
							<td class="det-tr-bg">{$mphj['td_m']}</td>
							<td class="det-tr-bg">{$mphj['hj_p']}</td>
							<td class="det-tr-bg">{$mphj['hj_m']}</td>
						</tr>
					</if>
					<if condition="$ec neq NULL">
						<foreach name="ec" item="vo" key="k">
						<tr>
							<if condition="$k eq 0">
								<td class="fbold Text_c middle" rowspan="{$echj['sum']}">二次消费</td>
							</if>
							<td class="Text_c">{$vo['third_name']}</td>
							<td colspan="5"></td>
							<td>{$vo['money']+0}</td>
						</tr>
						</foreach>
						<tr>
							<td class="fbold det-tr-bg Text_c middle">二次消费合计</td>
							<td class="det-tr-bg" colspan="6"></td>
							<td class="det-tr-bg">{$echj['hj']}</td>
						</tr>
					</if>
					<tr>
						<td class="fbold det-tr-bg Text_c middle">总计</td>
						<td class="det-tr-bg" colspan="6"></td>
						<td class="det-tr-bg">{$echj['hj']+$mphj['hj_m']}</td>
					</tr>
				</table>
			</div>
			</if>
			<if condition="($last neq NULL) or ($next neq NULL)">
			<div id="echarts" style="width: 100%;height:400px; margin-top: 50px"></div>
			</if>
			<if condition="(($operate['status'] eq 1) and ($answer neq NULL)) or ($audit eq 1)">
			<div class="form-sub-title">批复意见</div>
			<div class="reply-cont mb20">
				<foreach name="answer" item="ao" key="k">
				<div id="reply1" class="reply-list">
					<foreach name="ao['detail']" item="do">
						<div <if condition="$key egt 1">class="main_list item-list"<else/>class="item-list"</if>>
							<div class="clearboth">
								<div class="reply-pi ml10 absolute"><if condition="$key eq 0">{$k+1}楼</if></div>
								<div class="reply-prev">
									<if condition="($do['operate_detail_id'] neq NULL) or ($do['answer_id'] neq 0)">
										<div class="reply-bg">
											<if condition="$do['answer_id'] eq 0">
												<p>批复<b>{$ao['second_name']}-{$ao['third_name']}:</b></p>
												<p>{$ao['content']}</p>
											<else/>
												<p>对于<b>{$do['up_add_user']}:</b>的回复:</p>
												<p>{$do['up_answer_content']}</p>
											</if>
										</div>
									</if>
								</div>
							</div>
							<span class="reply-name">
								{$do['add_user']}：</span><span class="reply-comment">{$do['answer_content']}</span>
							<div class="reply-date">
								<if condition="(is_permission('ZB',NULL,1) and ($audit eq 1)) or ($project['director_uid'] eq $login_id) or ($project['manager_uid'] eq $login_id)"><a href="javascript:;" class="relpay mr5" data-id="1">回复</a><if condition="(1 eq $ao['count']) and ($key eq 0) and (is_permission('ZB',NULL,1) and ($audit eq 1)) and ($do['add_uid'] eq $login_id)"><a href="javascript:;" class="replay_edit mr5" data-id="2">编辑</a><a href="javascript:;" class="delete red mr5" comment_id="{$do['id']}">删除</a></if></if>{$do['add_date']}
							</div>
							<div class="replay_blk hide">
								<strong>发表回复</strong><br>
								<textarea class="form-control replay-textarea w500 h100" autocomplete="off"></textarea>
								<br>
								<button type="button" class="btn reply_sub mt5" reply_id="{$do['id']}" operate_detail_id="{$do['operate_detail_id']}" order_id="{$do['order_id']}" data-id="" fct="{$k+1}">提交</button>
								<input type="button" class="btn btn-default reply_cancel mt5 ml5" value="取消">
							</div>
						</div>
					</foreach>
				</div>
				</foreach>
			</div>
			<if condition="is_permission('ZB',NULL,1) and ($audit eq 1)">
			<div class="form-table-item">
				<p class="reply_txt hide">对于<span class="yellow"></span>的批复：<a href="javascript:;" class="start-using" data-toggle="tooltip" data-placement="left" title="清除"><i class="glyphicon glyphicon-remove-circle"></i></a><input type="hidden" name="replyid" value=""></p>
				<div>
					<textarea name="answer_content" class="form-control required-text" style="width:100%; max-width: 100%; height:150px" autocomplete="off"></textarea>
					<span class="error-item">必填项</span>
				</div>
			</div>
			</if>
			</if>
		</div>
		<div class="form-btn-item"><if condition="is_permission('ZB',NULL,1) and ($audit eq 1)"><button class="btn submit" type="button" sct="<?php echo count($answer)+1;?>">提交</button></if></div>
	</div>
</div>
<!--对话框-->
<div class="modal fade" id="deleteModal">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<h4>确认提示框</h4>
				<i class="fa fa-times" aria-hidden="true" data-dismiss="modal"></i>
			</div>
			<div class="modal-body">您确定要删除该评论吗？</div>
			<div class="modal-footer">
				<button type="button" class="btn del">确认</button>
				<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
			</div>
		</div>
	</div>
</div>
<include file="Include:javascript" />
<script type="text/javascript" src="__PUBLIC__/js/echarts.min.js"></script>
<script type="text/javascript">
	$(function(){
		$(window).scroll(function(){
			if($(window).scrollTop()>150){
				$('.fix_page').addClass('active');
			}else{
				$('.fix_page').removeClass('active');
			}
		})
		//提交验证
		$(".submit").on('click',function(){
			var tag = false;
			$(".required-text").each(function(){
				var val = $(this).val();
				if(val=="" || /^\s+$/.test(val)){
					$(this).next(".error-item").show();
					tag = true;
				}
			});
			
			if(tag){
				return false;
			}else{
				var mid = "{$operate['id']}",
					answer_content = $("[name='answer_content']").val(),
					replyid = $("[name='replyid']").val(),
					fct = $('.reply-list').size()+1;
				$.ajax({
					type:"POST",
					async:false,
					dataType:"json",
					data:{"id":mid,"answer_content":answer_content,"action":"answer","replyid":replyid},
					url:"__APP__/Project/project_operate_ajax",
					success:function(data){
						if(replyid){
							var html = '';
							html+= "<div id='reply1' class='reply-list'><div class='item-list'><div class='clearboth'><div class='reply-pi ml10 absolute'>"+fct+"楼</div><div class='reply-prev'><div class='reply-bg'>"+data.data.mark+"</div></div></div><span class='reply-name'>"+data.data.name+"：</span><span class='reply-comment'>"+data.data.con+"</span>"
							html+= "<div class='reply-date'><a href='javascript:;' class='relpay mr5' data-id='1'>回复</a><a href='javascript:;' class='replay_edit mr5' data-id='2'>编辑</a><a href='javascript:;' class='delete red mr5' comment_id='"+data.data.id+"'>删除</a>"+data.data.date+"</div>";
							html+= "<div class='replay_blk hide'><strong>发表回复</strong><br><textarea class='form-control replay-textarea w500 h100' autocomplete='off'></textarea><br><button type='button' class='btn reply_sub mt5' reply_id='"+data.data.id+"' operate_detail_id='"+data.data.operate_detail_id+"' order_id='"+data.data.order_id+"' data-id='' fct='"+fct+"'>提交</button><input type='button' class='btn btn-default reply_cancel mt5 ml5' value='取消'></div>";
							html+= "</div></div>";
							$('.reply-cont').append(html);
							$("[name='answer_content']").val('');
							$('.reply_txt').addClass('hide');
							var val = $("[name='replyid']").val();
							$('.table tr').each(function(){
								var oid = $(this).attr('oid');
								if(oid == val){
									$(this).find('.pf').html('已批复')
								}
							})
							$("[name='replyid']").val('');
						}else{
							var html = '';
							html+= "<div id='reply1' class='reply-list'><div class='item-list'><div class='clearboth'><div class='reply-pi ml10 absolute'>"+fct+"楼</div><div class='reply-prev'></div></div><span class='reply-name'>"+data.data.name+"：</span><span class='reply-comment'>"+data.data.con+"</span>"
							html+= "<div class='reply-date'><a href='javascript:;' class='relpay mr5' data-id='1'>回复</a><a href='javascript:;' class='replay_edit mr5' data-id='2'>编辑</a><a href='javascript:;' class='delete red mr5' comment_id='"+data.data.id+"'>删除</a>"+data.data.date+"</div>";
							html+= "<div class='replay_blk hide'><strong>发表回复</strong><br><textarea class='form-control replay-textarea w500 h100' autocomplete='off'></textarea><br><button type='button' class='btn reply_sub mt5' reply_id='"+data.data.id+"' operate_detail_id='"+data.data.operate_detail_id+"' order_id='"+data.data.order_id+"' data-id='' fct='"+fct+"'>提交</button><input type='button' class='btn btn-default reply_cancel mt5 ml5' value='取消'></div>";
							html+= "</div></div>";
							$('.reply-cont').append(html);
							$("[name='answer_content']").val('');
						}
					}
				});
			}
		})
		$(document).on("focus",".required-text",function(){
			$(this).nextAll(".error-item").hide();
		});
		//编辑评论
		$('body').on('click','.replay_edit',function(){
			var data_id = $(this).attr('data-id'),
				edit_text = $(this).parents('.item-list').find('.reply-comment').text();
			$(this).parents(".item-list").find(".replay_blk").slideDown().find('.replay-textarea').val(edit_text);
			$(this).parents(".item-list").find("strong").html("编辑回复");
			$(this).parents(".item-list").find(".reply_sub").attr({"data-id":data_id});
		})
		//取消错误提示
		$("textarea").focus(function(){
			var $val = $(this).val();
			if($val=="" || /^\s+$/.test($val) || $val=="请输入回复内容"){
				$(this).val("").removeClass("red");
			}
		});
		//删除评论
		$("body").on('click','.delete',function(){
			var comment_id = $(this).attr("comment_id");
			$("#deleteModal").find(".del").attr({"comment_id":comment_id}).end().modal();
		});
		$("#deleteModal").find(".del").click(function(){
			var comment_id = $(this).attr("comment_id");
			$("#deleteModal").hide();
			$.ajax({
				type:"POST",
				asnyc:true,
				dataType:"json",
				data:{"action":"answer_delete","id":comment_id},
				url:"__APP__/Project/project_operate_ajax",
				success:function(data){
					success_pop(data['status'],data['msg']);
				}
			});
		});
		//发表回复
		$("body").on('click','.relpay',function(){
			var data_id = $(this).attr('data-id');
			$(this).parents(".item-list").find(".replay_blk").slideDown().find('.replay-textarea').val('');
			$(this).parents(".item-list").find(".reply_sub").attr({"data-id":data_id});
			$(this).parents(".item-list").find("strong").html("发表回复");
		});
		$("body").on('click','.reply_sub',function(){
			var _this = $(this);
				$textarea = $(this).prevAll(".replay-textarea").eq(0),
				$val = $textarea.val(),
				$reply_id = $(this).attr("reply_id"),
				$operate_detail_id=$(this).attr("operate_detail_id"),
				$order_id=$(this).attr("order_id"),
				mid = "{$operate['id']}",
				data_id = $(this).attr('data-id'),
				fct = $(this).attr('fct');
			if($val=="" || /^\s+$/.test($val) || $val=="请输入回复内容"){
				$textarea.val("请输入回复内容").addClass("red");
			}else{
				if(data_id==1){
					$.ajax({
						cache:true,
						type:"POST",
						dataType:"json",
						url:"__APP__/Project/project_operate_ajax",
						data:{"id":mid,"action":"answer","answer_id":$reply_id,"order_id":$order_id,"operate_detail_id":$operate_detail_id,"answer_content":$val,"fct":fct},
						success:function(data){
							var html = '';
							html+= "<div class='main_list item-list'><div class='clearboth'><div class='reply-pi ml10 absolute'></div><div class='reply-prev'><div class='reply-bg'>"+data.data.mark+"</div></div></div><span class='reply-name'>"+data.data.name+"：</span><span class='reply-comment'>"+data.data.con+"</span>"
							html+= "<div class='reply-date'><a href='javascript:;' class='relpay mr5' data-id='1'>回复</a>"+data.data.date+"</div>";
							html+= "<div class='replay_blk hide'><strong>发表回复</strong><br><textarea class='form-control replay-textarea w500 h100' autocomplete='off'></textarea><br><button type='button' class='btn reply_sub mt5' reply_id='"+data.data.id+"' operate_detail_id='"+data.data.operate_detail_id+"' order_id='"+data.data.order_id+"' data-id='' fct='"+fct+"'>提交</button><input type='button' class='btn btn-default reply_cancel mt5 ml5' value='取消'></div>";
							html+= "</div>";
							$('.reply-list').eq(fct-1).append(html);
							_this.parent(".replay_blk").slideUp();
							_this.parents('.reply-list').find('.replay_edit').remove();
							_this.parents('.reply-list').find('.delete').remove();
						}
					});
				}else if(data_id==2){
					var val = _this.siblings('textarea').val();
					$.ajax({
						cache:true,
						type:"POST",
						dataType:"json",
						url:"__APP__/Project/project_operate_ajax",
						data:{"action":"answer_edit","answer_id":$reply_id,"answer_content":$val},
						success:function(data){
							_this.parents(".item-list").find('.reply-comment').html(val);
							_this.parent(".replay_blk").slideUp();
						}
					});
				}
			}
		});
		//回复取消
		$("body").on('click','.reply_cancel',function(){
			$(this).parents(".replay_blk").slideUp();
			$(this).prevAll(".replay-textarea").eq(0).val("").removeClass("red");
		});
		//批复
		$('.reply_btn').each(function(i){
			$(this).click(function(){
				var tdtxt = $(this).attr('txt'),
					trid = $(this).parents('tr').attr('oid');

				$('.reply_txt').removeClass('hide').find('span').html(tdtxt);
				$('html,body').animate({scrollTop:5000},500);
				$("[name='answer_content']").focus();
				$("[name='replyid']").val(trid);
			})
		})
		$('.reply_txt a').click(function(){
			$("[name='replyid']").val('');
			$('.reply_txt').addClass('hide').find('span').html('');
		})
	})

	// 基于准备好的dom，初始化echarts实例
	var myChart = echarts.init(document.getElementById('echarts'));
	// 指定图表的配置项和数据
	var option = {
		title: {
			text: '经营数据',
			subtext: '分析图'
		},
		toolbox: {
			show : true,
			feature : {
				magicType : {show: true, type: ['line', 'bar']},
				restore : {show: true},
				saveAsImage : {show: true}
			}
		},
		color: [{$color}],
		tooltip : {
			trigger: 'axis',
			axisPointer : {            // 坐标轴指示器，坐标轴触发有效
				type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
			}
		},
		legend: {
			data:[{$legend}]
		},
		grid: {
			left: '3%',
			right: '4%',
			bottom: '3%',
			containLabel: true
		},
		xAxis : [
			{
				type : 'category',
				data : [{$weeks}],
				axisTick: {
					alignWithLabel: true
				}
			}
		],
		yAxis : [
			{
				type : 'value'
			}
		],
		series : [
			{
				name: {$name[0]},
				type: 'line',
				label: {
					normal: {
						show: true,
						position: 'top'
					}
				},
				data: [{$sumss[0]}]
			},
			{
				name: {$name[1]},
				type: 'line',
				label: {
					normal: {
						show: true,
						position: 'top'
					}
				},
				data: [{$sumss[1]}]
			},
			{
				name: {$name[2]},
				type: 'line',
				label: {
					normal: {
						show: true,
						position: 'top'
					}
				},
				data: [{$sumss[2]}]
			}
		]
	};
	window.onresize = myChart.resize;
	// 使用刚指定的配置项和数据显示图表。
	myChart.setOption(option);
</script>
</body>
</html>
